import { useSelector, useDispatch } from "react-redux";
import { increment, decrement } from './store'

const App = () => {
  // 获取redux的数据
  const count = useSelector((state) => state);
  // 如果 state 是个对象，{page:1,list:[]} , useSelector((state) => state.list);
  const dispatch = useDispatch()
  return (
    <div>
      <div>计数器：{count}</div>
      <button onClick={()=>dispatch(increment(1))}>加1</button>
      <button onClick={()=>dispatch(decrement(1))}>减1</button>
    </div>
  );
};

export default App;
